<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSystemMediaTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_media', function (Blueprint $table) {
            $table->increments('id')->comment('ID');
            $table->string('origin_filename', 100)->nullable();
            $table->string('filename', 100)->index()->comment('文件名称');
            $table->string('ext', 20)->default('')->index()->comment('文件后缀');
            $table->unsignedInteger('category_id')->index()->comment('分类ID');
            $table->string('path')->comment('路径');
            $table->string('path_key', 32)->index()->comment('路径KEY');
            $table->string('size')->default('0')->comment('单位 Byte');
            $table->string('mime_type', 100)->nullable()->comment('文件类型');
            $table->dateTime('created_at')->nullable()->comment('创建时间');
            $table->dateTime('updated_at')->nullable()->comment('更新时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_media');
    }
}
